#include <limits.h>
#include "graph.hh"
#include "construct_greedy_randomized_solution.hh"
#include "local_search_neighborhood_randomly.hh"
#include "local_search_key_path.hh"
#include "utilis.hh"
using namespace std;

int test_graph(int argc, char *argv[])
{
	if(argc<2) cout << "Invalid arguments\n";
	char * path_file_in = argv[1]; // Load from argv[]
	char * path_file_out = argv[2]; // Load from argv[]

	Graph * G0 = new Graph(path_file_in);
	PrintGraph(G0);

	Path * path1 = new Path();
	for(int i=0; i<5; i++)
		path1->path->push_front(i);

	Path * path2 = new Path();
	for(int i=2; i<5; i++)
		path2->path->push_front(i);

	G0->Add(path1);

	cout << "Cost path: " << G0->CostPath(path1) << endl;
	G0->Substract(path2);

	delete path1;
	delete path2;

	PrintGraph(G0);

	Graph * G1 = new Graph(G0->sizeG);
	PrintGraph(G1);

	Graph * G2 = new Graph(G0);
	PrintGraph(G2);


	cout << "Cost " << G2->Cost() << endl;


	//// Node 7 ////
	cout << "Grade node 7: " << G2->GetNodeGrade(6) << endl;  //si hay n nodos voy de 0 a n-1
	cout << "Neighbors 7: " << endl;
	list<int> * neighbors = G2->GetNeighbors(6); //si hay n nodos voy de 0 a n-1
	for (list<int>::iterator it=neighbors->begin(); it != neighbors->end(); ++it)
		cout << *it << " ";
	cout << endl;
	cout << "Is terminal 7: " << G2->IsTerminal(6) << endl;  //si hay n nodos voy de 0 a n-1

	///////////////////////////////////////////
	G2->actived_node[3] = 0;  // desabilito manuelmnete el node 4, si hay n nodos voy de 0 a n-1
	//////////////////////////////////////////

	cout << "Grade node 7: " << G2->GetNodeGrade(6) << endl;  //si hay n nodos voy de 0 a n-1
	cout << "Neighbors 7: " << endl;
	neighbors = G2->GetNeighbors(6); //si hay n nodos voy de 0 a n-1
	for (list<int>::iterator it=neighbors->begin(); it != neighbors->end(); ++it)
		cout << *it << " ";
	cout << endl;
	cout << "Is terminal 7: " << G2->IsTerminal(6) << endl;  //si hay n nodos voy de 0 a n-1
	cout << "Cost " << G2->Cost() << endl;

	///////////////////////////////////////////
	G2->actived_node[3] = 1;  // habilito manuelmnete el node 4, si hay n nodos voy de 0 a n-1
	G2->E[4][6] = 0; // si hay n nodos voy de 0 a n-1

	//////////////////////////////////////////

	cout << "Grade node 7: " << G2->GetNodeGrade(6) << endl;  //si hay n nodos voy de 0 a n-1
	cout << "Neighbors 7: " << endl;
	neighbors = G2->GetNeighbors(6); //si hay n nodos voy de 0 a n-1
	for (list<int>::iterator it=neighbors->begin(); it != neighbors->end(); ++it)
		cout << *it << " ";
	cout << endl;
	cout << "Is terminal 7: " << G2->IsTerminal(6) << endl;  //si hay n nodos voy de 0 a n-1
	cout << "Cost " << G2->Cost() << endl;

	//// FIN - Node 7 ////

	G2->Dump(path_file_out);

	delete G0;
	delete G1;
	delete G2;

	return 0;
}
